package com.ctcemti.mdm.project.sys.dao;

import com.ctcemti.mdm.project.sys.entity.ResEntElementTree;
import com.ctcemti.mdm.project.sys.entity.ResEntElementTree;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.IdsMapper;

import java.util.List;

@Mapper
public interface ResEntElementTreeMapper extends tk.mybatis.mapper.common.Mapper<ResEntElementTree>,IdsMapper<ResEntElementTree> {
    /**
     * 子查父
     * @param resEntElementTree
     * @return
     */
    List<ResEntElementTree> selectAllResEntElementTree(ResEntElementTree resEntElementTree);

    /**
     * 父查子
     * @param resEntElementTree
     * @return
     */
    List<ResEntElementTree> selectChildsByHierarchy(ResEntElementTree resEntElementTree);

    /**
     * 通过id查询实体
     * @param resEntElementTree
     * @return
     */
    ResEntElementTree queryResEntElementTreeByID(ResEntElementTree resEntElementTree);

    /**
     * 修改
     * @param resEntElementTree
     * @return
     */
    int updateResEntElementTreeByID(ResEntElementTree resEntElementTree);

    /**
     * 批量删除
     * @param
     * @return
     */
    int deleteToCascade(Integer[] ids);

    /**
     * 移动
     * @param
     * @return
     */
    int moveResEntElementTree(ResEntElementTree resEntElementTree);

    /**
     * 同步
     * @param
     * @return
     */
    int syncResEntElementTree(ResEntElementTree resEntElementTree);

    /**
     * 同步前删除
     * @param
     * @return
     */
    int deleteElementsMethodsByDisciplineId(ResEntElementTree resEntElementTree);

    /**
     * 根据企业ebS删除关系表
     * @param
     * @return
     */
    int deleteElementsMethods(Integer[] ids);

//    /**
//     * 根据专业、领域删除ebs
//     * @param
//     * @return
//     */
//    int deleteEBSTreeByDisciplineId(Integer[] ids);
//    /**
//     * 根据专业、领域删除ebs工法关系表
//     * @param
//     * @return
//     */
//    int deleteEBSTreeMethodsByDisciplineId(Integer[] ids);

    /**
     * 移动ebs树的同时移动关系表
     * @param
     * @return
     */
    int moveResEntElementTreeMethod(ResEntElementTree resEntElementTree);

    /**
     * 批量插入
     * @param
     * @return
     */
    int insertBatch(List<ResEntElementTree> var);

    /**
     * 根据uuid去查id 更新parentid
     * @param
     * @return
     */
    void updateParentIDByUUID(@Param("disciplinesId")String disciplinesId);

    int queryEBSCodeHasExist(ResEntElementTree resEntElementTree);

    int getMaxHierarchy(ResEntElementTree resEntElementTree);


    /**
     * 根据id查EBS
     * @param
     * @return
     */
    List<ResEntElementTree> selectEBSByIds(Integer[] ids);

    int deleteRelMethodByEbs(List<ResEntElementTree> list);
}
